<%@ page language="java" import="java.sql.*" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ page import="control.*"%>
<% 
request.setCharacterEncoding("utf-8");
String id = request.getParameter("id");
String que = request.getParameter("que");
String ans = request.getParameter("ans");
System.out.println(id);
System.out.println(que);
System.out.println(ans);

Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
  
try{
	ServerIp ip = new ServerIp();
	Class.forName(ip.getDriver());
	conn = DriverManager.getConnection(ip.getUrl(),ip.getId(),ip.getPw());
	String sql="select mb_pw from member_info where mb_id=? and mb_pw_que=? and mb_pw_ans=?";
	pstmt=conn.prepareStatement(sql);
	pstmt.setString(1, id);
	pstmt.setString(2, que);
	pstmt.setString(3, ans);
	rs = pstmt.executeQuery();
}catch(Exception e){
	e.printStackTrace();
}

if(rs.next()){
	out.println("비밀번호 입니다.<br/><br/>");
	String pw = rs.getString("mb_pw");
	out.println( " 요청하신 비밀번호는 " + pw +" 입니다.");
}else{
	out.println("입력하신 정보가 등록되어 있지않거나 아이디 및 질문의 답변을 잘못입력하셨습니다.");
}


conn.close();pstmt.close();rs.close();
%>
<br/><br/><center><a href="" onClick="javascript:self.close()">확인</a></center>